﻿@model RTW.OA.Models.wf_flowstepinfo
@{

    Layout = "~/Views/Shared/_LayoutBase.cshtml";
}

@section styles{

}
<div id="dMain">
    <div class="wrapper wrapper-content animated fadeInRight">
        @*@using (Html.BeginForm("flowstepnext", "Step", FormMethod.Post, new { area = "System", id = "stepfrom", name = "stepfrom" }))
        {*@
        <div class="ibox" style="margin-bottom: 0px;">
            <div class="ibox-title">
                <h4> @Html.DisplayFor(m => m.NAME)   @ViewBag.Title </h4>
            </div>
            <div class="ibox-content">
                <div id="toolbar">
                    <a class="btn btn-sm btn-success radius" onclick="addnextstep(@ViewBag.Stepid)" style="margin-top: 10px;"><i class="iconfont icon-tianjia"></i>&nbsp; 新建下一步骤</a>
                </div>
                <table id="NextStepDataTable"></table>
            </div>
        </div>
        @*  }*@
    </div>
</div>
@section scripts{
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/bootstrap-table.min.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/locale/bootstrap-table-zh-CN.min.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/bootstrap-table-export.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/tableExport.js")"></script>
    <script src="@Url.Content("~/Content/js/common/bootstrap-table/bootstrap-table-cookie.js")"></script>
    @*<script type="text/javascript" charset="utf-8" src="../js/uploader.js"></script>*@

    <script src="@Url.Content("~/Content/JS/common/from.js")"></script>
    <script>
        $(function () {
            //初始化表单验证
            //$("#stepfrom").initValidform();

            $('#NextStepDataTable').bootstrapTable({
            //  height: tabHeight + 50,
            url: '/System/Step/GetTableNextJsonResult?flowid=' + @ViewBag.stepid,         //请求后台的URL（*）
            method: 'get',                      //请求方式（*）
            //data: $("#dJson").text() != "" ? JSON.parse($("#dJson").text()) : "",
            dataType: "json",
            columns: [
				{
                    title: "下一步骤序号", field: 'NEXTSTEPNO', align: 'center'
                },
				{
                    title: "下一步骤显示", field: 'NEXTNAME', align: 'center'
                },
				{
                    title: "步骤备注", field: 'NEXTTEXT', align: 'center'
                },
				   							   							   							   							   							   							   							   							   							   							   							   							   			            {
                field: '#',
                title: "操作",
                align: 'center',
                valign: 'middle',
                formatter: function (value, row, index) {
                    var ids = row.ID;
                    return '<a class=" btn btn-danger btn-xs  " onclick="del(' + ids +')">删除</a>';
                }
            }
        ],
        toolbar: '#toolbar',//工具按钮用哪个容器
        buttonsClass: "sm btn-white",//按钮class
        pageSize: 10,//分页条数
        clickToSelect: false,//设置true 将在点击行时，自动选择单选或复选框
        singleSelect: false,//为true则禁止多选
        cache: false,//是否缓存
        cookie: true,//是否启用cookie
        cookieIdTable: "Step",//cookie键值
        pagination: true,//是否分页
        showColumns: true,//是否显示所有的列
        showRefresh: true,//是否显示刷新按钮
        search: false,//是否启用搜索
        showPaginationSwitch: true,//是否显示分页切换按钮
        showExport: true,//是否启用导出
        striped: false,//是否显示行间隔色
        detailView: false,//是否显示切换视图列
        //detailFormatter: detailFormatter,//卡片视图内容格式化
        onDblClickRow: function (row, obj) { //双击行事件
            // window.top.showFullPage("图像阅读器（" + (row.FileNo) + "）", "/See.aspx?FID=" + row.ID);
            @*parent.createTab('78103','工作表步骤表明细','@Url.Action("Details", "Step", new { area = "System" })/' + row.ID + '');*@
        },
        onClickRow: function (row, obj) { //单击行事件
            $(obj).parent().find("tr").removeClass("selected");
            $(obj).addClass("selected");

            ////根据选中的行获取子表数据
            //GetSonData(row.ID);
        },
        onSearch: function (text) {
            if (text != "") {
                $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                    var str = "<span class=\"bg-yellow\">" + text + "</span>";
                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(text, str);
                    $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                })
            }
        }
    });


        });
        function savefrom() {
            $("#stepfrom").submit();
        }
                   function del(id) {
            layer.confirm('是否删除此步骤？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                var url = '@Url.Action("NextDelete", "Step", new { area = "System" })\/' + id;
                $.get(url, function (result) {
                    $("#NextStepDataTable").bootstrapTable('refresh', { url: '/System/Step/GetTableNextJsonResult?flowid=' + @ViewBag.stepid});
                    layer.msg('删除工作表步骤表成功！',{ icon: 1,
                        time: 2000//2s后自动关闭
                    });
                });
            }, function () {

            });
        }

        function Getrefresh(id) {
            if (id != null) {
               $("#NextStepDataTable").bootstrapTable('refresh', { url: '/System/Step/GetTableNextJsonResult?flowid=' + @ViewBag.stepid});

            }
            }
        function addnextstep(id) {
                layer.open({
                    type: 2,
                    shadeClose: true,
                    shade: 0.8,
                    skin: 'layui-layer-rim', //加上边框
                    area: ['80%', '90%'], //宽高
                    content: '@Url.Action("Flowstepnextadd", "Step", new { area = "System" , stepid= ViewBag.stepid, flowid= ViewBag.flowid })'
                });
        }
    </script>

}
